<!DOCTYPE html>
<html>
<body>
This test verifies that canvas animations update properly with anuimation loops that use setTimeout. Eight vertical green bars should appear below this text.
<canvas id="c" width="400" height="200"></canvas>
<script type="text/javascript">
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'green';
var xpos = 0;

if (window.testRunner) {
    testRunner.waitUntilDone();
}

function draw() {
    ctx.fillRect(xpos, 0, 40, 200);
    xpos = xpos + 50;
    if (xpos < 400) {
        window.setTimeout(draw, 16);
    } else {
        if (window.testRunner) {
            testRunner.notifyDone();
        }
    }
}

draw();
</script>
</body>
</html>
